package cn.edu.zafu.bigdata.x.zbw;

// Movable 接口
// Movable 接口
 interface Movable {
    void move();
    void stop();
}

// Resizable 接口
 interface Resizable {
    void resize(double factor);
}


// Car 类，实现 Movable 接口
 class Car2 implements Movable {
    @Override
    public void move() {
        System.out.println("The car is moving.");
    }

    @Override
    public void stop() {
        System.out.println("The car has stopped.");
    }
}

// ResizableCircle 类，实现 Movable 和 Resizable 两个接口
 class ResizableCircle implements Movable, Resizable {
    double radius;

    public ResizableCircle(double radius) {
        this.radius = radius;
    }

    @Override
    public void move() {
        System.out.println("The circle is moving.");
    }

    @Override
    public void stop() {
        System.out.println("The circle has stopped.");
    }

    @Override
    public void resize(double factor) {
        radius *= factor;
        System.out.println("The new radius of the circle is: " + radius);
    }
}

public class TestInterface {
    public static void main(String[] args) {
        // 创建 Car 和 ResizableCircle 的实例
        Car car = new Car();
        ResizableCircle circle = new ResizableCircle(5.0);

        // 验证每个类对接口方法的实现
        car.move();
        //car.stop();

        circle.move();
        circle.stop();
        circle.resize(2.0); // 仅对 ResizableCircle 调用
    }
}